﻿using System.IO;
using System.Web;

namespace Nana.Web
{
  public abstract class ResponseFilterFactory
  {
    public abstract void SetupHeaders(HttpContext context);
    public abstract Stream CreateFilter(Stream baseFilter);
    public virtual Stream SetupFilter(HttpResponse response)
    {
      return response.Filter = CreateFilter(response.Filter);
    }
    public virtual Stream SetupFilter(HttpContext context)
    {
      return SetupFilter(context.Response);
    }
    public virtual Stream OneShotFinish(HttpContext context)
    {
      SetupHeaders(context);
      return SetupFilter(context);
    }
  }
}